Skip to content

feat(auth): replace GitHub OAuth with GitHub App OAuth#139

Merged
Che-Zhu merged 1 commit intomainfrom
feature/github-app-oauth
Mar 6, 2026
Merged

feat(auth): replace GitHub OAuth with GitHub App OAuth#139
Che-Zhu merged 1 commit intomainfrom
feature/github-app-oauth

Conversation

@Che-Zhu
Copy link
Copy Markdown
Collaborator

@Che-Zhu Che-Zhu commented Mar 6, 2026

Summary

  • Replace legacy GitHub OAuth with GitHub App OAuth for NextAuth
  • Add refresh token support for automatic token renewal
  • Auto-trigger GitHub App installation after login
  • Update settings dialog to use GitHub App installation flow
  • Remove deprecated GitHub OAuth API routes

Changes

New Features

  • GitHub App OAuth provider with refresh token support
  • Auto-trigger GitHub App installation after successful login
  • Token auto-refresh mechanism (expires in 8 hours, refreshes 1 hour before expiry)

Breaking Changes

  • GITHUB_CLIENT_ID / GITHUB_CLIENT_SECRET are no longer used
  • Use GITHUB_APP_CLIENT_ID / GITHUB_APP_CLIENT_SECRET instead

Removed

  • app/api/auth/github/callback/route.ts (deprecated)
  • app/api/user/github/route.ts (deprecated)
  • app/api/user/github/bind/route.ts (deprecated)

Environment Variables

Required:

  • GITHUB_APP_ID - GitHub App ID
  • GITHUB_APP_CLIENT_ID - OAuth Client ID
  • GITHUB_APP_CLIENT_SECRET - OAuth Client Secret
  • GITHUB_APP_PRIVATE_KEY - Private Key for API calls
  • GITHUB_APP_WEBHOOK_SECRET - Webhook secret
  • NEXT_PUBLIC_GITHUB_APP_NAME - App name for installation URL

Test Plan

  1. Login with GitHub - should redirect to GitHub App OAuth
  2. After login, should auto-trigger GitHub App installation popup
  3. Install the app and verify installation is saved
  4. Create a project and push to GitHub - should work with new token format

- Create GitHub App OAuth provider for NextAuth
- Update auth.ts to use new provider with refresh token support
- Update repoService.ts to use getUserGitHubToken() for token management
- Add auto-trigger GitHub App installation after login
- Update settings-dialog.tsx to use GitHub App installation flow
- Remove deprecated GitHub OAuth API routes
- Update environment variables template

Breaking change: GITHUB_CLIENT_ID/GITHUB_CLIENT_SECRET replaced with GITHUB_APP_CLIENT_ID/GITHUB_APP_CLIENT_SECRET~
@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 6, 2026

✅ PR Check Results: Passed

Build Checks

Check Status
Lint & Build ✅ Passed
Docker Build ✅ Passed

✨ Great work!

All checks passed successfully. Your PR is ready for review.

Details:

  • ✅ Code quality verified (linting passed)
  • ✅ Build successful
  • ✅ Docker image build verified (linux/amd64)
    Commit: f38ed0dbcd4f3a13bd3e7d6807a998a226515e20
    Branch: feature/github-app-oauth

🔗 View Details:

@Che-Zhu Che-Zhu merged commit 0044c0a into main Mar 6, 2026
9 checks passed
@Che-Zhu Che-Zhu deleted the feature/github-app-oauth branch March 6, 2026 06:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant